//
//  MMLaunchTool.m
//  zhihuDaily
//
//  Created by 赖锦浩 on 16/6/11.
//  Copyright © 2016年 cc. All rights reserved.
//

#import "MMLaunchTool.h"

@interface MMLaunchTool ()

/** 网络管理者  */
@property (nonatomic, strong) MMHTTPSessionManager *manager;


@end
@implementation MMLaunchTool
#pragma mark - 懒加载
- (MMHTTPSessionManager *)manager
{
    if (!_manager) {
        _manager = [MMHTTPSessionManager manager];
    }
    
    return _manager;
}

+ (void)getLaunchImageWithCompleted:(void (^)(id))completed failure:(void (^)())failure
{
    NSString *launchImgUrl = @"http://news-at.zhihu.com/api/4/start-image/720*1184";
    
    MMHTTPSessionManager *manger = [MMHTTPSessionManager manager];
    
    [manger GET:launchImgUrl parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
        NSString *urlStr = responseObject[@"img"];
        if (completed == nil) return ;
        completed(urlStr);
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        if (failure == nil) return ;
        
    
    }];

}

@end
